<template>
  <el-form ref="form" :model="LoginForm" label-width="80px">
    <el-form-item label="账号">
      <el-input v-model="LoginForm.username"></el-input>
    </el-form-item>
    <el-form-item label="密码">
      <el-input type="password" v-model="LoginForm.password"></el-input>
    </el-form-item>
    <el-form-item>
      <el-button type="primary" @click="login()">立即创建</el-button>
      <el-button>取消</el-button>
    </el-form-item>
  </el-form>
</template>

<script>
export default {
  data(){
    return{
      LoginForm:{
        username:'admin',
        password:'admin'
      }
    }
  },
  created(){
    // this.login()
  },methods:{

    async login(){
      console.log(window.location.href)
      const{data:res} = await this.$ajax.post('http://lishuaichuang.com/api/login/login', this.LoginForm)
      //const{data:res} = await this.$ajax.post('http://56a41221.r12.cpolar.top/api/login/login', this.LoginForm)//家
      // const{data:res} = await this.$ajax.post('https://9b4da5f.r6.cpolar.top/api/login/login', this.LoginForm)//公司
      if (res.code == 1){
        this.$msg.success('登录成功')
        window.sessionStorage.setItem('token',res.token)
        this.$router.push('/')
      }else{
        this.$msg.error(res.msg)
      }
    }
  }
}
</script>

<style scoped>

</style>